/*
 * Group:PrePool K9-357 
 * 8/2010
 */
package blo;

import org.apache.log4j.Logger;

import dao.WordDAO;

/**
 * 
 * 
 */
public class AddWordBLO {
	private WordDAO wordDAO;
	public static Logger LOG = Logger.getLogger("blo.AddWordBLO");
	/**
	 * Constructor
	 */
	public AddWordBLO() {
		wordDAO = new WordDAO();
	}

	/**
	 * function addWord to database.
	 * 
	 * @param word
	 *            word suggested by user
	 * @param meaning
	 *            meaning suggested by user
	 * @param from
	 *            id of from language that chose by user
	 * @param to
	 *            id of to language that chose by user
	 * @return true if add to database successful,false if can not
	 */
	public boolean addSugestWord(String word, String meaning, int dictID) {
		return wordDAO.addWord(word, meaning, dictID, 0);
	}

	/**
	 * @param id
	 *            id of word in DB
	 * @return true if successful,false if fail
	 */
	public boolean deleteSuggestWord(int id) {
		return wordDAO.deleteWord(id);
	}

	/**
	 * 
	 * @param id
	 *            id of word in DB
	 * @param meaning
	 *            meaning will be updated
	 * @return true if successful,false if fail
	 */
	public boolean updateSuggestWord(int id, String meaning) {
		return wordDAO.updateWord(id, meaning);
	}

	/**
	 * @param id
	 *            id of word in DB
	 * @param status
	 *            status will be updated
	 * @return true if successful,false if fail
	 */
	public boolean updateSuggestWord(int id, int status) {
		return wordDAO.updateWord(id, status);
	}
}
